﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="loopUpForGrade.aspx.cs" Inherits="Student_loopUpForGrade" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>查詢學生歷年成績</title>
    <style type="text/css">


        .style1
        {
            font-family: 微軟正黑體;
            font-size: xx-large;
            text-align: center;
        }
        .style2
        {
            text-align: center;
        }
        .style3
        {
            width: 89%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="style2">
    
        <span class="style1">查詢學生歷年成績</span><br />
        <br />
        目前身分：<asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <br />
        <table align="center" class="style3">
            <tr>
                <td>
                    目前選擇 課程&nbsp; 
                    <asp:Label ID="Label2" runat="server"></asp:Label>
&nbsp;
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="查詢課程資訊" />
&nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    目前選擇 教師&nbsp; 
                    <asp:Label ID="Label3" runat="server"></asp:Label>
&nbsp;
                    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="查詢教師資訊" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
                        AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" 
                        ForeColor="#333333" GridLines="None" Width="649px" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="CourseId" HeaderText="課程編號" 
                                SortExpression="CourseId" />
                            <asp:BoundField DataField="CourseName" HeaderText="課程名稱" 
                                SortExpression="CourseName" />
                            <asp:BoundField DataField="TeacherId" HeaderText="教師編號" ReadOnly="True" 
                                SortExpression="TeacherId" />
                            <asp:BoundField DataField="TeacherName" HeaderText="授課教師" 
                                SortExpression="TeacherName" />
                            <asp:BoundField DataField="Year" HeaderText="年份" SortExpression="Year" />
                            <asp:BoundField DataField="Semester" HeaderText="學期" 
                                SortExpression="Semester" />
                            <asp:BoundField DataField="Point" HeaderText="學分" SortExpression="Point" />
                            <asp:BoundField DataField="Grade" HeaderText="成績" SortExpression="Grade" />
                            <asp:CommandField ButtonType="Button" ShowSelectButton="True" />
                        </Columns>
                        <EditRowStyle BackColor="#7C6F57" />
                        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#E3EAEB" />
                        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F8FAFA" />
                        <SortedAscendingHeaderStyle BackColor="#246B61" />
                        <SortedDescendingCellStyle BackColor="#D4DFE1" />
                        <SortedDescendingHeaderStyle BackColor="#15524A" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            
            
            SelectCommand="SELECT CourseTaken.StudentId, CourseTaken.CourseId, CourseTaken.Grade, Course.CourseName, Course.Year, Course.Semester, Course.Point, Teacher.TeacherName, Teacher.TeacherId FROM CourseTaken INNER JOIN Course ON CourseTaken.CourseId = Course.CourseId INNER JOIN Teaching ON Course.CourseId = Teaching.CourseId INNER JOIN Teacher ON Teaching.TeacherId = Teacher.TeacherId WHERE (CourseTaken.StudentId = @StudentId)">
            <SelectParameters>
                <asp:ControlParameter ControlID="Label1" Name="StudentId" PropertyName="Text" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
    
    </div>
    </form>
</body>
</html>
